package pile.customer.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import pile.customer.entity.ResponseResult;
import pile.customer.service.IQuickReplyService;
import org.springframework.beans.factory.annotation.Autowired;
import pile.customer.entity.QuickReply;

import pile.customer.params.quickReply.DeleDTO;
import pile.customer.params.quickReply.ListDTO;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 郭天义
 * @since 2024-07-09
 */
@RestController
@RequestMapping("/quickReply")
public class QuickReplyController {

   @Autowired
   private IQuickReplyService quickReplyService;


   /**
   *  新增
   * @param quickReply
   * @return
   */
   @PostMapping("/add")
   public ResponseResult add(@Validated @RequestBody QuickReply quickReply){
        return quickReplyService.add(quickReply);
   }

   /**
   *  删除
   * @param deleDTO
   * @return
   */
   @PostMapping("/dele")
   public ResponseResult dele(@Validated @RequestBody DeleDTO deleDTO){
        return quickReplyService.dele(deleDTO);
   }

    /**
    *  信息
    * @param quickReplyId
    * @return
    */
    @GetMapping("/info")
    public ResponseResult info(@RequestParam Integer quickReplyId){
        return  quickReplyService.info( quickReplyId);
    }

    /**
    * 编辑 
    * @param quickReply
    * @return
    */
    @PostMapping("/edit")
    public ResponseResult edit(@Validated @RequestBody  QuickReply quickReply){
        return  quickReplyService.edit(quickReply);
    }

    /**
    *  列表
    * @param listDTO
    * @return
    */
    @PostMapping("/list")
    public ResponseResult listPage(@Validated @RequestBody ListDTO listDTO){
    return  quickReplyService.listPage(listDTO);
    }


    @PostMapping("/listToTree")
    public ResponseResult listToTree(@Validated @RequestBody ListDTO listDTO){
        return  quickReplyService.listToTree(listDTO);
    }

}
